﻿<link href="@Url.Content("~/content/activitie_detail.css")" rel="stylesheet" type="text/css" />

@model PessMvc.Models.ArchiveGradeModel

@{
    ViewBag.Title = "Grade";
}
<div id="m-title">
    <h2>评分</h2>
    <div id="m-op">
        @Html.ActionLink("返回", "Index", new { activityID = Model.ActivityID, archiveID = Model.Archive.ID }, null)
    </div>
</div>

@if (Model.IsArchiveProfileVisible)
{
    @Html.Partial("_ArchiveDetailsPartial", Model.Archive, new ViewDataDictionary() { { "HideArchiveDetails", Model.HideArchiveDetails } })
}

@if (Model.IsArchiveBasicInfoVisible)
{
    <div style="display:none;">
        <div>档案名称</div>
        <div>@Model.Archive.ProjectTitle</div>
        <div>编号</div>
        <div>@Model.Archive.SerialNumber</div>
        <div>学校评语</div>
        <div>@Model.Archive.SchoolComment</div>
        <div>区县评语</div>
        <div>@Model.Archive.CountyEBComment</div>
    </div>
}


<div class="f-grade">
    @if (Model.IsArchivePDFVisible)
    {
        <div style="width:795px;float:left;padding-top:2px;padding-right:0px;padding-left:0px;clear:both;margin-top:-45px;overflow:hidden;">
            <object data=@Url.Action("GetPDF", new { archiveID=Model.Archive.ID}) type="application/pdf" style="width:99%;height:850px;">
                alt : <a href="http://down.tech.sina.com.cn/download/d_load.php?d_id=8255&down_id=1&ip=61.170.136.41">下载PDF阅读器。</a>
            </object>
                        @if (Model.IsArchiveAttachmentVisible)
{
                <div id="showFile" class="displayValue" style="width:790px;margin-top:10px;">
                    @{
    var grid = new WebGrid(Model.Archive.Attachments, defaultSort: "Title");
                    }
                    @grid.GetHtml(columns: from c in grid.Columns(
                 grid.Column("Title", header: " 文件名 ", format: @<text>@Html.ActionLink((string)item.Title, "Download", "Archive", new { archiveID = Model.Archive.ID, title = (string)item.Title }, null)</text>, style:"thAction2"),
                 grid.Column("FileSize", header: " 文件大小（KB） "),
                 grid.Column("TimeStamp", header: " 最后修改时间 "),
                 grid.Column("Operation", header: "操作", format: @<text>@if(Model.IsModificationAllowed){Html.ActionLink("删除", "DeleteAttachment", "Archive", new { archiveID = Model.Archive.ID, title = (string)item.Title }, null);}</text>)
             )
                                           where !c.ColumnName.Contains("Operation") || (Roles.IsUserInRole("Admin") || Roles.IsUserInRole("CountyAdmin"))
                                           select c
                                                                              )
                </div>
}
        </div>
        
    }
    <fieldset class="edit" style="width:192px;float:right;padding-top:0px;margin-left:0px;margin-right:0px;position:relative;">
        <legend style="font-size:14px;">档案编号：@ViewBag.SerialNumber</legend>
        @using (Html.BeginForm("Grade", "Archive", FormMethod.Post))
        {
            @Html.Hidden("ArchiveID", Model.Archive.ID)
            @Html.ValidationSummary(true)
            <div class="u-gd-tb">
                <table style="width:190px">
                    <tr>
                        <th>名称</th>
                        @*<th>说明</th>*@
                        <th>分值</th>
                        <th></th>
                    </tr>
                    @{var scoreList = Model.Scores.ToList();}
                    @for (int i = 0; i < scoreList.Count(); i++)
                    {
                        <tr style="text-align:center;">
                            <td style="width:92px" alt="@scoreList[i].Description" title="@scoreList[i].Description">@scoreList[i].Name</td>
                            @*<th>@scoreList[i].Description</th>*@
                            <td style="width:48px">@scoreList[i].Value</td>
                            <td style="width:48px">
                                @Html.Hidden("scoreList[" + i + "].ID", scoreList[i].ID)
                                @Html.Hidden("scoreList[" + i + "].ArchiveID", Model.Archive.ID)
                                @if (scoreList[i].InputControl == null || scoreList[i].InputControl == (int)PessModel.InputControlMode.TextBox)
                                {
                                    @Html.TextBox("scoreList[" + i + "].ScoreValue", (object)scoreList[i].ScoreValue == null ? 0 : (decimal)scoreList[i].ScoreValue, new { style = "width:40px" })
                                }
                                else
                                {
                                    @Html.ScoreInputControl("scoreList[" + i + "].ScoreValue", (int)scoreList[i].Value, (object)scoreList[i].ScoreValue == null ? 0 : (int)scoreList[i].ScoreValue)
                                }
                            </td>
                        </tr>
                    }
                </table>
                @*<p>指标1和2的总分在10分以上为通过；
                    指标3的分值为1表示通过，0表示不通过。</p>*@
                <p>@ViewBag.ScoringInstruction</p>
            </div>
            <div style="text-align:center">
                @Html.TextArea("Comment", new { style = "width:186px;height:240px;margin-top:5px;margin-bottom:8px;", onclick = "if (this.innerHTML=='请输入评语') {this.innerHTML='';}", onblur = "if (this.innerHTML=='') {this.innerHTML='请输入评语';}" })
            </div>
            <span class="editor-btn-inLine downM" style="padding-left:12px;padding-right:8px;"><input type="submit" value="保存" class="u-btn" /> </span>
        }

        <span class="editor-btn-inLine downM">
            @using (Html.BeginForm("DeleteScores2", "Score", FormMethod.Post))
            {
                @Html.Hidden("ArchiveID", Model.Archive.ID)
                <input type="submit" value="删除分数" class="f-btn-delS" style="width: 60px; color: #d9534f; border: none; height: 24px; line-height:24px; top: 5px; cursor: pointer;" />
            }
        </span>

    </fieldset>
</div>

<p style="clear:both;">&nbsp; </p>
        @if (Model.IsArchiveHistroyVisible)
        {
            @Html.Partial("_PreviousArchivesPartial", new ViewDataDictionary(Model.PreviousArchives))
        }
        
<script type="text/javascript">
    //document.getElementById("Comment").innerHTML = "请输入评语";
</script>

